This application relates to and incorporates herein by reference Japanese Patent Application No. 10-185804 filed on Jul. 1, 1998.
1. Field of the Invention
The present invention relates to a memory data writing apparatus and method, and more particularly to an apparatus and method for rewriting a latest updated data into a rewritable nonvolatile memory.
2. Related Art
In an electronic control system for vehicles, a rewritable nonvolatile memory is used to store various data for controlling a control object. For instance, original data stored in a rewritable nonvolatile memory such as an EEPROM is transferred to and written into a readable/rewritable volatile memory such as a RAM by an initial setting operation at the time of power-on of an electronic computer, so that a control object is controlled using the data transferred from the nonvolatile memory and stored in the volatile memory. Latest updated data stored in the volatile memory is transferred to and written back into the nonvolatile memory again at the time of power-off of the computer. This operation is necessary, because nonvolatile memories have a limitation in the number of writing operations and is not capable of writing data from time to time as opposed to volatile memories.
More specifically, the computer executes its programmed application processing as shown in FIGS. 7 and 8. That is, original data stored in an EEPROM 16 is transferred to and written into the storage area (A) 131 of a RAM 13 in the initial setting operation at step S401 ({circle around (1)} in FIG. 8). Then, when this data is to be written back into the EEPROM 16, it is written into the storage area (A) 131 of the RAM 13 at step S402 ({circle around (3)} in FIG. 8). When the updated data in the EEPROM 16 is to be read out, it is read out from the storage area (A) 131 of the RAM 13 at step S403 ({circle around (4)} in FIG. 8). Finally, in the power-off operation, the latest updated data stored in the RAM 13 is written back into the EEPROM 16 at step S404 ({circle around (2)} in FIG. 8).
If some data, which may be a vehicle identification code or vehicle diagnosis results, are broken or lost due to accidental power-off or the like before or during writing back of the latest data into the nonvolatile memory, the vehicle can not be operated or the vehicle diagnosis can not be attained later. It is therefore proposed to compare the data in the nonvolatile memory and the data in the volatile memory at shortest possible time interval, and to write back the data stored in the volatile memory into the nonvolatile memory when those data differ from each other. However, as the time period required to the writing data into the nonvolatile memory is longer than a normal control program processing time period, the computer must interrupt its control program processing for the execution of the writing processing as shown in FIG. 9. This interruption for the data writing into the nonvolatile memory (EEPROM) in the course of the application processing is disadvantageous, because the control program processing is desired to be executed for a real time control on the control object.
It is an object of the present invention to provide an improved memory data writing apparatus and method which are free from the above disadvantage.
It is a further object of the present invention to provide a memory data writing apparatus and method which enable writing back of data into a nonvolatile memory without affecting a control program execution.
According to the present invention, an original data stored in a nonvolatile memory is written into a volatile memory to be updated in a control calculation processing of a CPU. If the updated data is the type which is to be written back into the nonvolatile memory again, a writing request is issued at the same time of writing the updated data into the volatile memory and an address and size of the updated data are also written into the volatile memory as a related data. Actual rewriting of the updated data into the nonvolatile memory is executed based on the related data in a separate data writing processing in response to the writing request.